﻿<?php
/**
 * Page Template
 *
 * Loaded automatically by index.php?main_page=product_info.<br />
 * Displays details of a typical product
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_product_info_display.php 5369 2006-12-23 10:55:52Z drbyte $
 */
 //require(DIR_WS_MODULES . '/debug_blocks/product_info_prices.php');
?>
<div class="centerColumn" id="productGeneral">

<!--bof Top div start-->
<div id="productInfoTop">
<!--bof Form start-->
<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?>
<!--eof Form start-->

<?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>



<!--bof Main Product Image -->
<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>
<!--eof Main Product Image-->

<!--bof Brief Product Info-->
<div id="briefProductInfo">
<table width="100%" align="left">
	<tr>
		<td>
		<!--bof Product Name-->
		<h2 id="productName"><?php echo $products_name; ?></h2>
		<!--eof Product Name-->
		</td>
	</tr>
	<tr>
		<td>
			<table>
				<tbody>
					<tr>
						<th>市场价格：</th>
						<td style="text-align:left;font-size:14px;font-weight:bold;color:#ff9900">
							<!--bof Product Price block -->
							<?php
							// base price
					  			if ($show_onetime_charges_description == 'true') {
								    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
					  			} else {
								    $one_time = '';
					  			}
								 if ($pr_attr->fields['total'] > 0) {
								 	echo $one_time .  zen_get_products_display_price((int)$_GET['products_id']).'／1000克(2斤)';
								}else {
									echo $one_time .  zen_get_products_display_price((int)$_GET['products_id']);	
								}
							?>
							<!--eof Product Price block -->		
						</td>
					</tr>
				
    						<!--bof Attributes Module -->
							<?php
							  if ($pr_attr->fields['total'] > 0) {
							?>
							<?php
							/**
							 * display the product atributes
							 */
							  require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes.php'); ?>
							<?php
							  }
							?>
							<!--eof Attributes Module -->


							<!--bof Add to Cart Box -->
							<?php
							if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
							  // do nothing
							} else {
							?>
							            <?php
							               if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
							              // hide the quantity box and default to 1
							              $the_button = '<tr><td><input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
							            } else {
							              // show the quantity box
							    $the_button = '<tr><th>'.PRODUCTS_ORDER_QTY_TEXT .'</th><td><label>'. '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /></label></td></tr><tr><td>' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
							            }
							    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
							  ?>
							  <?php if ($display_qty != '' or $display_button != '') { ?>
							    <div id="cartAdd">
							    <?php
							      echo $display_button;
							            ?>
							          </div>
							  <?php } // display qty and button ?>
							<?php } // CUSTOMERS_APPROVAL == 3 ?>
							<!--eof Add to Cart Box-->
						</td>
					</tr>
							
					</tbody></table>
		
		
		
		</td>
	</tr>
	
	</table>

</div>
<!--eof Brief Product Info-->
</div>
<!--eof Top div end-->
<!--bof Form close-->
</form>
<!--bof Form close-->
<br class="clearBoth" />
<!--bof Middle Tabs div start-->
<div id="productInfoMiddle">

<div id="productInfoMiddleTabs"><a style="cursor: hand" onclick="expandcontent('sc1', this)"><span>详细介绍</span> </a>
								<a style="cursor: hand" onclick="expandcontent('sc2', this)"><span>菜谱</span></a>
								<a style="cursor: hand" onclick="expandcontent('sc3', this)"><span>用户的详细评价</span></a>
								<a style="cursor: hand" onclick="expandcontent('sc4', this)"><span>发表评论</span></a>
								<a style="cursor: hand" onclick="expandcontent('sc5', this)"><span>推荐给好友</span></a>
      <br class="clearBoth" />
</div>
<div id="container">
      <div style="display: block;" id="sc1" class="tabcontent">
	  	<!--bof Product description -->
		<?php if ($products_description != '') { ?>
		<div id="productDescription"><?php echo stripslashes($products_description); ?></div>
		<?php } ?>
		<!--eof Product description -->
		<br class="clearBoth" />
	  </div>
	  <div style="display: none;text-align: left;" id="sc2">制作中.......</div>
	  <div style="display: none;" id="sc3">
	  		  <!--bof Product review -->
			  <?php
			  if ($reviews_split->number_of_rows > 0) {
			    if ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3')) {
			?>
			
			<div id="productReviewsDefaultListingTopNumber"><?php echo $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS); ?></div>
			
			<div id="productReviewsDefaultListingTopLinks"><?php echo TEXT_RESULT_PAGE . ' ' . $reviews_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'main_page'))); ?></div>
			
			<?php
			    }
			    foreach ($reviewsArray as $reviews) {
			?>
			<hr />
			
			<div ><?php echo zen_break_string(zen_output_string_protected(stripslashes($reviews['reviewsText'])), 60, '-<br />') . ((strlen($reviews['reviewsText']) >= 100) ? '...' : ''); ?></div>
			<div ><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, zen_date_short($reviews['dateAdded'])); ?>&nbsp;<?php echo sprintf(TEXT_REVIEW_BY, zen_output_string_protected($reviews['customersName'])); ?></div>
			
			<div ><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'stars_' . $reviews['reviewsRating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviewsRating'])), sprintf(TEXT_OF_5_STARS, $reviews['reviewsRating']); ?></div>
			
			
			<br class="clearBoth" />
			<?php
			    }
			?>
			<?php
			  } else {
			?>
			<hr />
			<div id="productReviewsDefaultNoReviews" class="content"><?php echo TEXT_NO_REVIEWS . (REVIEWS_APPROVAL == '1' ? '<br />' . TEXT_APPROVAL_REQUIRED: ''); ?></div>
			<br class="clearBoth" />
			<?php
			  }
			
			  if (($reviews_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
			?>
			<hr />
			<div id="productReviewsDefaultListingBottomNumber" class="navSplitPagesResult"><?php echo $reviews_split->display_count(TEXT_DISPLAY_NUMBER_OF_REVIEWS); ?></div>
			<div id="productReviewsDefaultListingBottomLinks" class="navSplitPagesLinks"><?php echo TEXT_RESULT_PAGE . ' ' . $reviews_split->display_links(MAX_DISPLAY_PAGE_LINKS, zen_get_all_get_params(array('page', 'info', 'main_page'))); ?></div>
			
			<?php
			  }
			?>
			
			    <div><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array('reviews_id'))) . '">' . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . '</a>'; ?></div>
	   </div><!--eof Product review -->
	  <div style="display: none;" id="sc4">
	  		<!--bof Product review writing-->
	  		<?php echo zen_draw_form('product_reviews_write', zen_href_link(FILENAME_PRODUCT_INFO, 'action=process&products_id=' . $_GET['products_id'], 'SSL'), 'post', 'onsubmit="return checkForm(product_reviews_write);"'); ?>
			
			
			<h3 id="reviewsWriteReviewer" class=""><?php echo SUB_TITLE_FROM, zen_output_string_protected($customer->fields['customers_firstname'] . ' ' . $customer->fields['customers_lastname']); ?></h3>
			<br class="clearBoth" />
			
			<?php if ($messageStack->size('review_text') > 0) echo $messageStack->output('review_text'); ?>
			
			<div id="reviewsWriteReviewsRate" style="text-align:left;"><?php echo SUB_TITLE_RATING; ?></div>
			
			<div id="ratingRow" >
			<label for="rating-1"><?php echo zen_draw_radio_field('rating', '1', '', 'id="rating-1"'); ?>
			<?php echo zen_image($template->get_template_dir(OTHER_IMAGE_REVIEWS_RATING_STARS_ONE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . OTHER_IMAGE_REVIEWS_RATING_STARS_ONE, OTHER_REVIEWS_RATING_STARS_ONE_ALT) . '</label> '; ?>
			
			<label class="" for="rating-2"><?php echo zen_draw_radio_field('rating', '2', '', 'id="rating-2"'); ?>
			<?php echo zen_image($template->get_template_dir(OTHER_IMAGE_REVIEWS_RATING_STARS_TWO, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . OTHER_IMAGE_REVIEWS_RATING_STARS_TWO, OTHER_REVIEWS_RATING_STARS_TWO_ALT) . '</label>'; ?>
			
			<label class="" for="rating-3"><?php echo zen_draw_radio_field('rating', '3', '', 'id="rating-3"'); ?>
			<?php echo zen_image($template->get_template_dir(OTHER_IMAGE_REVIEWS_RATING_STARS_THREE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . OTHER_IMAGE_REVIEWS_RATING_STARS_THREE, OTHER_REVIEWS_RATING_STARS_THREE_ALT) . '</label>'; ?>
			
			<label class="" for="rating-4"><?php echo zen_draw_radio_field('rating', '4', '', 'id="rating-4"'); ?>
			<?php echo zen_image($template->get_template_dir(OTHER_IMAGE_REVIEWS_RATING_STARS_FOUR, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . OTHER_IMAGE_REVIEWS_RATING_STARS_FOUR, OTHER_REVIEWS_RATING_STARS_FOUR_ALT) . '</label>'; ?>
			
			<label class="" for="rating-5"><?php echo zen_draw_radio_field('rating', '5', '', 'id="rating-5"'); ?>
			<?php echo zen_image($template->get_template_dir(OTHER_IMAGE_REVIEWS_RATING_STARS_FIVE, DIR_WS_TEMPLATE, $current_page_base,'images'). '/' . OTHER_IMAGE_REVIEWS_RATING_STARS_FIVE, OTHER_REVIEWS_RATING_STARS_FIVE_ALT) . '</label>'; ?>
			</div>
			<br class="clearBoth" />
			<label id="textAreaReviews" for="review-text"><?php echo SUB_TITLE_REVIEW; ?></label>
			<?php echo zen_draw_textarea_field('review_text', 60, 5, '', 'id="review-text"'); ?>
			
			    <div class="buttonRow forward"><?php echo zen_image_submit(BUTTON_IMAGE_SUBMIT, BUTTON_SUBMIT_ALT); ?></div>
			<br class="clearBoth" />
			
			<div id="reviewsWriteReviewsNotice" class="notice"><?php echo TEXT_NO_HTML . (REVIEWS_APPROVAL == '1' ? '<br />' . TEXT_APPROVAL_REQUIRED: ''); ?></div>
			</form>
	  </div><!--eof Product review writing-->
	  
	  
	  <!--bof Product tell a friend-->
	  <div style="display: none;" id="sc5">
	  
	  <?php echo zen_draw_form('email_friend', zen_href_link(FILENAME_TELL_A_FRIEND, 'action=process&products_id=' . $_GET['products_id'])); ?>

		<?php if ($messageStack->size('friend') > 0) echo $messageStack->output('friend'); ?>
		<div id="tellAFriend">
		<fieldset>
		
		
		<label for="from-name"><?php echo FORM_FIELD_CUSTOMER_NAME; ?>&nbsp;&nbsp;&nbsp;&nbsp;</label>
		<?php echo zen_draw_input_field('from_name','','id="from-name"') . '&nbsp;<span class="alert">' . ENTRY_FIRST_NAME_TEXT . '</span>'; ?>
		<br class="clearBoth" />
		
		<label for="from-email-address"><?php echo FORM_FIELD_CUSTOMER_EMAIL; ?>&nbsp;&nbsp;&nbsp;&nbsp;</label>
		<?php echo zen_draw_input_field('from_email_address','','id="from-email-address"') . '&nbsp;<span class="alert">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>'; ?>
		<br class="clearBoth" />
		
		<label for="to-name"><?php echo FORM_FIELD_FRIEND_NAME; ?>&nbsp;&nbsp;&nbsp;&nbsp;</label>
		<?php echo zen_draw_input_field('to_name', '', 'id="to-name"') . '&nbsp;<span class="alert">' . ENTRY_FIRST_NAME_TEXT . '</span>'; ?>
		<br class="clearBoth" />
		
		<label for="to-email-address"><?php echo FORM_FIELD_FRIEND_EMAIL; ?>&nbsp;&nbsp;&nbsp;&nbsp;</label>
		<?php echo zen_draw_input_field('to_email_address', $_GET['to_email_address'], 'id="to-email-address"') . '&nbsp;<span class="alert">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>'; ?>
		<br class="clearBoth" />
		
		<label for="email-message"><?php echo FORM_TITLE_FRIEND_MESSAGE; ?>&nbsp;&nbsp;&nbsp;&nbsp;</label>
		<?php echo zen_draw_textarea_field('message', 30, 5, '', 'id="email-message"'); ?>
		<br class="clearBoth" />
		
		<label>&nbsp;&nbsp;&nbsp;&nbsp;</label>
		<input name="submit" class="buttonStyle" value="发送" type="submit">
		<br class="clearBoth" />
		</fieldset>
		</div>
					
		<div id="tellAFriendAdvisory"><?php echo EMAIL_ADVISORY_INCLUDED_WARNING .'<br class="clearBoth" />'. str_replace('-----', '', EMAIL_ADVISORY); ?></div>
		
		</form>
	</div><!--eof Product tell a friend-->
</div>



<!--bof Additional Product Images -->
<?php
/**
 * display the products additional images
 */
  require($template->get_template_dir('/tpl_modules_additional_images.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_images.php'); ?>
<!--eof Additional Product Images -->

</div>
<!--eof Middle Tabs div end-->

<!--bof also purchased products module-->
<?php require($template->get_template_dir('tpl_modules_also_purchased_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_also_purchased_products.php');?>
<!--eof also purchased products module-->


</div>